%
% gs_lex.m
%
%   Perform n steps of gs lex.
%
%   input  -- u = initial value of solutions
%             A = matrix
%             f = right hand side
%             n = number of sweeps to perfrom
%   output -- v = result after gslex
%
function v = gs_lex(u,A,f,n);
  
  D  = diag(diag(A));
  Ut = triu(A) - D;
  DL = A - Ut;

  v = u;
  for k=1:n
    v = DL\(f - Ut*v);
  end
 
